import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)



// =================
// 各个模块的导入
// =================
import index from "../pages/index/index.vue"
import books from "../pages/books/books.vue"
import clothes from "../pages/clothes/clothes.vue"
import phone from "../pages/phone/phone.vue"
import goodsDetail from "../components/common/goods_detail/goods_detail.vue"
import userInfo from "../components/common/user_info/user_info.vue"
// ============================
// 公共模块导入
// ============================
import userInfoTrack from "../components/common/user_info/children/children/user_info_track.vue"
import userInfoGoods from "../components/common/user_info/children/children/user_info_goods.vue"
import userInfoRatings from "../components/common/user_info/children/children/user_info_ratings.vue"
const router_user_info = {
	path: "/user_info",
	component: userInfo,
	children: [{
		path: "",
		component: userInfoTrack
	},{
		path: "track",
		component: userInfoTrack
	},{
		path: "goods",
		component: userInfoGoods
	},{
		path: "ratings",
		component: userInfoRatings
	}]
}
// ============================
// 主页模块导入
// ============================
const router_main = {
	name: "main",
	path: "/index",
	component: index
}
const router_index = {
	name: "index",
	path: "/",
	redirect: "/index"
}
// ============================
// 书籍模块导入
// ============================
import booksDetail from "../pages/books/children/books_detail.vue"//代表根据不同的分类(例如：考研,四六级)展示不同的结果
import booksMain from "../pages/books/children/main.vue"//代表刚刚进入页面默认的显示

const router_books = {
	path: "/books",
	component: books,
	children: [{
		path: "",
		component: booksMain
	},{
		name: "books_detail",
		path: "books_detail/:type",
		component: booksDetail
	}]
}
// ============================
// 衣服模块导入
// ============================
const router_clothes = {
	name: "clothes",
	path: "/clothes",
	component: clothes
}
// ============================
// 平板手机模块导入
// ============================
const router_phone = {
	name: "phone",
	path: "/phone",
	component: phone
}
// ============================
// 物品详情模块导入
// ============================
const router_goods_detail = {
	name: "goods_detail",
	path: "/goods_detail",
	component: goodsDetail
}




// =======================
// 路由导入
// =======================
const routes = [];
routes.push(router_main);
routes.push(router_index);
routes.push(router_books);
routes.push(router_clothes);
routes.push(router_phone);
routes.push(router_goods_detail);
routes.push(router_user_info);
















export default new Router({
	mode: 'history',
	routes,
	linkActiveClass: "active"
})